# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=pciutils
pkgver=3.10.0
pkgrel=0
pkgdesc="PCI bus configuration space access library and tools"
url="http://mj.ucw.cz/pciutils.html"
arch="all"
license="GPL-2.0-only"
depends="hwdata-pci"
makedepends="linux-headers"
options="!check"
subpackages="$pkgname-doc $pkgname-dev $pkgname-libs"
source="$pkgname-$pkgver.tar.gz::https://github.com/pciutils/pciutils/archive/refs/tags/v$pkgver.tar.gz
	pread.patch
	"

build() {
	make OPT="$CFLAGS -fPIC -flto=auto" ZLIB=no \
		SHARED=yes \
		PREFIX=/usr \
		SHAREDIR=/usr/share/hwdata \
		MANDIR=/usr/share/man \
		all
}

package() {
	make PREFIX="$pkgdir"/usr \
		SHARED=yes \
		SHAREDIR="$pkgdir"/usr/share/hwdata \
		MANDIR="$pkgdir"/usr/share/man \
		install install-lib

	# this is now supplied by the hwids package
	rm -rf "$pkgdir"/usr/sbin/update-pciids
	rm -rf "$pkgdir"/usr/share/man/man8/update-pciids.8
	rm -rf "$pkgdir"/usr/share/hwdata
}

sha512sums="
a2599e40cf6b7f84d0af8e87edcb016452fcca15b7a77b9844b00b0f93085a94650a867c3c8a0441bd9f2bb02080f7c90982dbc2b4c998b9fa63f5f2e90dc9cd  pciutils-3.10.0.tar.gz
aa1d3272500180256929b39a5fc4ea38ddb6a9fad090d732832ded9cc396303cf56efc91cfdeb76edbcfefc9a7c8eb058562c3c2b09a9090a59d3e68c27cec62  pread.patch
"
